(ns cyberdelia.player)

(defn new-player [name]
  (atom {:name name
         :health 100
         :energy 100
         :x 0
         :y 0}))

(defn update-health [player health]
  "set the player health"
  (swap! player assoc :health health))

(defn take-damage [player damage]
  "subtract (or add) from player health"
  (swap! player assoc :health (-
                               (@player :health)
                               damage)))
